exports.createPages = async ({ graphql, actions }) => {
  const { createPage } = actions
  let { data } = await graphql(`
  query {
    allArticleMockData {
      nodes {
        id
      }
    }
  }
  `)

  data.allArticleMockData.nodes.forEach(article => {
    createPage({
      path: `/articleDetail/${article.id}`,
      component: require.resolve("../../src/templates/articleDetail.js"),
      context: {
        id: article.id,
      },
    })
  })
}
